﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace iS3.DAL.SQLSERVER
{
    public class ExternalStorageEngineFactory
    {
        public static IExternalStorageEngine getInstance(ExternalStorageConfig config,SQLConn conn,string tableNameOrPrefix)
        {
            if (config == null)
            {
                return new ExternalStorageEngine_Normal(tableNameOrPrefix);
            }
            switch (config.SubTableRule)
            {
                case "0":
                    return new ExternalStorageEngine_Normal(config.TableNameOrPrefix);
                case "1":
                    return new ExternalStorageEngine_TimeSplit(conn, config.TableNameOrPrefix, config.SubTableParam);
                default:return null;
            }
        }
    }
}
